import React from 'react';
import './App.css';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Login from "./components/Login";
import Main from './components/Main'
import requireLogin from './requireLogin'
import { store } from "./store";
import { menuList } from "./store/action";

function App() {
  store.dispatch(menuList()) // 刷新重新获取数据
  return (
    <BrowserRouter>
      <Switch>
        <Route path='/login' component={Login}></Route>
        {/* <Route path='/register' component={Register}></Route> */}
        <Route path='/' component={requireLogin(Main)}></Route>
      </Switch>
    </BrowserRouter>
  )
}

export default App;
